//
//  XQPhotoViewModel.swift
//  PhotoSelect
//
//  Created by 王帅强 on 2019/1/7.
//  Copyright © 2019 王帅强. All rights reserved.
//

import UIKit
import Photos

class XQPhotoViewModel {

    lazy var photoList: [XQPhotoModel] = []

    func loadPhotoList(albumAssetsResult: PHFetchResult<PHAsset>?, completion: @escaping(_ success: Bool, _ message: String?) -> ()) {

        guard let result = albumAssetsResult else {
            completion(false, "请选择相册")
            return
        }

        for i in 0..<result.count {
            let asset = result[i]
            let photo = XQPhotoModel(asset: asset)
            photoList.append(photo)
        }
        completion(true, nil)

    }
}
